package com.seata.logic.visualize.tcc;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

/**
 * @author 蚂蚁会花呗
 * @date 2021/9/27 9:43
 */
@LocalTCC
public interface StorageTccAction {


    /**
     *
     * @param businessActionContext
     * @param prodId 产品主键id
     * @param count 数量
     * @return
     */
    @TwoPhaseBusinessAction(name = "storageAction",commitMethod = "commit",rollbackMethod = "rollback")
    boolean decreaseStorage(BusinessActionContext businessActionContext,
                            @BusinessActionContextParameter(paramName = "prodId") String prodId,
                            @BusinessActionContextParameter(paramName = "count") Integer count);



    boolean commit(BusinessActionContext businessActionContext);


    boolean rollback(BusinessActionContext businessActionContext);


}
